<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<title>商品详情</title>
		<link rel="stylesheet" href="css/bootstrap.min.css" type="text/css" />
		<script src="JS/jquery-1.11.3.min.js" type="text/javascript"></script>
		<script src="JS/bootstrap.min.js" type="text/javascript"></script>
		<!-- 引入自定义css文件 style.css -->
		<link rel="stylesheet" href="css/style.css" type="text/css" />

		<style>
			body {
				margin-top: 20px;
				margin: 0 auto;
			}
			
			.carousel-inner .item img {
				width: 100%;
				height: 300px;
			}
		</style>
		
<script type="text/javascript">
function addtocart(src){
	$.ajax({
        url:"${pageContext.request.contextPath}/AddtocartServlet",
        async:false,
        type:"post",
        data:{'cmdyid':src.name,'buynum':$("#quantity").val()},
        dataType:"json",
        success:function(d){
        	if(d.msg==1){
        		alert("添加成功")
        		window.location.reload();
        	}else if(d.msg==3){
        		alert("请先登录")
        	}else {
        		alert("添加失败")
        	}
        }
    });
}
</script>		
		
	</head>

	<body>

		
			<!--
            	时间：2015-12-30
            	描述：菜单栏
            -->
			<div class="container-fluid">
				<div class="col-md-4">
					
				</div>
				<div class="col-md-5">
					<img src="img/header.png" />
				</div>
				<div class="col-md-3" style="padding-top:20px">
					<%@ include file="jhtop.jsp" %>   <!-- 顶部动态字 -->
				</div>
			</div>
			<!--
            	时间：2015-12-30
            	描述：导航条
            -->
			<%@ include file="/jhtop1.jsp" %>   <!-- 商品类型显示和搜索框 -->


		<div class="container">
			<div class="row">
				

				<div style="margin:0 auto;width:950px;">
					<div class="col-md-6">
						<img style="opacity: 1;width:400px;height:350px;" title="" class="medium" src="${pageContext.request.contextPath }${commodity1.img }">
					</div>

					<div class="col-md-6">
						<div><strong>${commodity1.cmdyname }</strong></div>
						<div style="border-bottom: 1px dotted #dddddd;width:350px;margin:10px 0 10px 0;">
			
						</div>

						<div style="margin:10px 0 10px 0;">价格: <strong style="color:#ef0101;">${commodity1.price}元</strong> 
						</div>

				

						<div style="padding:10px;border:1px solid #e7dbb1;width:330px;margin:15px 0 10px 0;;background-color: #fffee6;">

							<div style="border-bottom: 1px solid #faeac7;margin-top:20px;padding-left: 10px;">购买数量:
								<input id="quantity" name="quantity"  maxlength="4" size="10" type="text" value = "1"> </div>

							<div style="margin:20px 0 10px 0;;text-align: center;">
								<a onclick="addtocart(this)" name="${commodity1.cmdyid }" href="#">
									<input style="background: url('./img/product.gif') no-repeat scroll 0 -600px rgba(0, 0, 0, 0);height:36px;width:127px;" value="加入购物车" type="button">
								</a>
							</div>
						</div>
					</div>
				</div>
				<div class="clear"></div>
				<div style="width:950px;margin:0 auto;">
					<div style="background-color:#d3d3d3;width:930px;padding:10px 10px;margin:10px 0 10px 0;">
						<strong>商品介绍</strong>
					</div>

					<div>
						${commodity1.detail }
					</div>

					<div style="background-color:#d3d3d3;width:930px;padding:10px 10px;margin:10px 0 10px 0;">
						<strong>商品参数</strong>
					</div>
					<div style="margin-top:10px;width:900px;">
						<table class="table table-bordered">
							<tbody>
								<tr class="active">
									<th colspan="2">基本参数</th>
								</tr>
								<tr>
									<th width="10%">货号:${commodity1.cmdyid}</th>
									<td width="30%"></td>
								</tr>
								
							</tbody>
						</table>
					</div>

					<div style="background-color:#d3d3d3;width:900px;">
						<table class="table table-bordered">
							<tbody>
								<tr class="active">
									<th><strong>商品评论</strong></th>
								</tr>
								<tr class="warning">
									<th>暂无商品评论信息 <a>[发表商品评论]</a></th>
								</tr>
							</tbody>
						</table>
					</div>

				</div>

			</div>
		</div>

		

	</body>

</html>